package com.tepth.busfix.main.home;

import com.tepth.busfix.bean.reponse.BusType;
import com.tepth.busfix.bean.reponse.TroubleContent;
import com.tepth.busfix.network.ApiModel;
import com.tepth.busfix.network.Network;

import java.util.List;

import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import okhttp3.RequestBody;

/**
 * Created by TMVPHelper on 2017/03/13
 */
public class HomeModel implements HomeContract.Model {

    @Override
    public Observable<ApiModel<List<BusType>>> getBusType(String authKey) {
        return Network.getApiService().busType(authKey).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }

    @Override
    public Observable<ApiModel<List<TroubleContent.Operation>>> getOperationList(String authKey) {
        return Network.getApiService().operationList(authKey).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }

    @Override
    public Observable<ApiModel<String>> startRepair(String authKey, String body) {
        return Network.getApiService().startRepair(authKey,body).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }
}